<?php
error_reporting(E_ALL ^ E_NOTICE);

use Net\Connection;

require_once './Net/Connection.php';
require_once './Net/Event.php';

$client = new Connection();

//则塞模式
$client->setBlock(true);

$client->connect('127.0.0.1', 30001);

if($client->isReady()) {
    echo "连接成功!\n";
    $client->send('hello hello hello');
    sleep(1);
    $client->send('are you ok');
    sleep(1);
    
    $message = $client->recv();
    echo "服务器回复: $message\n";
    
    sleep(3);
    $client->send('exit');
} else {
    echo "连接错误: {$client->getLastError()} {$client->getLastErrorMessage()}\n";
}




